package com.dingup.provider.mapper;

import com.dingup.api.adapter.user.SysUserAdapter;
import com.dingup.api.bean.requestBean.student.StudentPageBean;
import com.dingup.api.model.student.Student;
import com.dingup.api.model.sys.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SysUserMapper {
    int deleteByPrimaryKey(String userId);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    SysUser selectByPrimaryKey(String userId);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    List<SysUser> getBySysUser(SysUser user);

    SysUser getByUserAccount(String Account);

    SysUser getByUserEmail(String email);

    SysUser getByUnionId(String unionId);

    List<SysUser> listAllUser();

    List<SysUser> getUserByDeptId(Long deptId);

    List<SysUser> getUserByDeptIds(@Param("deptIds") List<Long> deptIds);

    int updateDelete(@Param("userIds") List<String> userIds, @Param("ifDelete") Boolean ifDelete);

    int updateIfDeleteByUserId(@Param("userId") String userId, @Param("ifDelete") Boolean ifDelete);

    List<Student> selectStudent(Student student);

    Integer selectStudentTotal(Student student);

    SysUser getByUserId(String userId);

    List<SysUserAdapter> getUserByUserNameOrAccount(@Param("query") String query, @Param("ifExternalUser") Boolean ifExternalUser);

    List<SysUser> getUserByDeptAndRole(@Param("deptIds") List<Long> deptIds, @Param("roleId") Integer roleId);

    List<SysUser> getStudentByCreateUserIds(@Param("createUserIds") List<String> createUserIds);

    List<Student> selectStudentByPageBean(StudentPageBean studentPageBean);

    Integer selectStudentTotalByPageBean(StudentPageBean studentPageBean);

    List<SysUser> getAllUserNameAndUserIds(@Param("ifSystemUser") Boolean ifSystemUser);

    List<SysUserAdapter> getUserByDeptIdsAndCreateUserIds(@Param("deptIds") List<Long> deptIds,
                                                          @Param("userIds") List<String> userIds,
                                                          @Param("query") String query,
                                                          @Param("ifExternalUser") Boolean ifExternalUser,
                                                          @Param("limitBefore") Integer limitBefore,
                                                          @Param("limit") Integer limit);

    Integer getUserByDeptIdsAndCreateUserIdsCount(@Param("deptIds") List<Long> deptIds,
                                                  @Param("userIds") List<String> userIds,
                                                  @Param("query") String query,
                                                  @Param("ifExternalUser") Boolean ifExternalUser);

    /**
     * 获取指定科目老师
     *
     * @param sysSubjectId
     * @return
     */
    List<SysUserAdapter> getBySysSubjectId(@Param("sysSubjectId") Integer sysSubjectId);
}